updating oE save_bitmap

save_bitmap

include image.e 
namespace image 
public function save_bitmap(two_seq palette_n_image, sequence file_name) 

create a .BMP bitmap file, given a palette and a 2-d sequence of sequences of colors.

Parameters:
  1. palette_n_image : a {palette, image} pair, like read_bitmap returns
  2. file_name : a sequence, the name of the file to save to.
Returns:

An integer, 0 on success.

Comments:

This routine does the opposite of read_bitmap(). The first element of palette_n_image is a list of sequences each sequence containing exactly three color intensity values in the range 0 to 255. The second element is a list of sequences of colors. The inner sequences must have the same length. Each element in the each inner sequence represents the color index in palette_n_image of a pixel. Each inner sequence is a row in the image.

The result will be one of the following codes:

public constant 
    BMP_SUCCESS = 0, 
    BMP_OPEN_FAILED = 1, 
    BMP_INVALID_MODE = 4 -- invalid graphics mode 
                         -- or invalid argument 

save_bitmap produces bitmaps of 2, 4, 16, or 256 colors and these can all be read with read_bitmap. Windows Paintbrush and some other tools do not support 4-color bitmaps.

Example 1:
code = save_bitmap({paletteData, imageData}, 
                   "c:\\example\\a1.bmp") 
See Also:

read_bitmap

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu